feat(web): add attachment staging lifecycle - #388
Conversation
|
CI context: both Linux Node jobs reach the pre-existing packed standalone Web CLI smoke, install the tarball, and then the server exits before announcing its origin ( This PR does not change package metadata, CLI startup, or peer-dependency resolution. Its local check, focused tests, full Node suite, and Vitest suite pass as recorded in the PR body. |
tt-a1i
left a comment
There was a problem hiding this comment.
Exact-head re-review of 9ebd185. The previous metadata bounds and missing cleanup findings have been addressed; focused tests pass (5/5). However, the new startup reclamation can delete a different live store and its unconsumed attachments. This is a lifecycle/data-loss blocker, independently reproduced with the real module in a unique temporary parent. No host/UI or deployed impact is claimed; the store is not yet wired to an upload route.
f8ac1bd to
eba69a6
Compare
|
@tt-a1i 已补齐 TTL、name/mime 256 UTF-8 bytes 限制及回归测试;随后又补上 owner/liveness proof,避免启动回收删除仍存活的 store。 |
|
@tt-a1i 已修复 P1:startup reclaim 现在读取 sibling PID owner marker;owner 存活则保留,旧无 marker 根目录才按 TTL 回收。live-store/orphan 回归通过。 |
tt-a1i
left a comment
There was a problem hiding this comment.
Exact-head review of be9eab7. The staging design has useful binding and cleanup boundaries, but two independently reproduced P2 resource-lifecycle problems remain. Please fix these in this PR and add regression coverage; no author code was modified during review. This module is not yet connected to an upload route, so these are component findings rather than claims about deployed behavior. Related tracking: #441.
|
已推送 |
tt-a1i
left a comment
There was a problem hiding this comment.
Reviewed exact head 51706c6.
The host-owned staging primitive is useful and is not wired into current user/model behavior, but two reproducible P1 integrity/lifecycle blockers remain:
- [P1] Changed bytes can be accepted as canonical. The store records and verifies path/type/size, but not content identity. On the exact head, staging safe, overwriting the payload with same-length evil, then consuming returns consumed with evil. Persist and verify a digest or authoritative opened-file identity, and close the check/read TOCTOU.
- [P1] discard marks the batch settled before deletion succeeds. If rm fails, the first call rejects, but a retry reports settled/discarded while the bytes remain. Only settle after cleanup succeeds, or persist an explicit failed/retryable cleanup state.
[P2] Workspace ownership is also raw absolute-string equality rather than a proven canonical path, so aliases can become distinct owners.
Focused tests and required CI are green, but they do not cover these exact failure cases. The P1s block merging this as the canonical attachment-byte authority.
Problem
The attachment work tracked by #344 has admission metadata validation in review, but no host-owned lifecycle for canonical temporary bytes. Browser filenames must not become filesystem authority, and staged bytes need exact command ownership and deterministic cleanup.
Value
Future composer and multimodal prompt work gets a fail-closed storage primitive with bounded resource use, single-consume semantics, and explicit stale or settled receipts.
Approach
Add a private attachment staging store that:
This is a focused backend slice and intentionally does not duplicate #365/#380 metadata admission validation or #384 UI work.
Validation
Impact
Related to #344.